//////////////////////////////////////////////////////////////////////////////////
//	 Copyright 2011 by Yosef Grabivker, ryuho@homenetworksoft.com
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
//////////////////////////////////////////////////////////////////////////////////

#include <wx/wx.h>
#include <wx/hyperlink.h>
#include <wx/gbsizer.h>
#include "updatedlg.h"

CUpdateDlg::CUpdateDlg(const wxString& strVer, const wxString& strPath):
	wxDialog((wxWindow *)NULL, wxID_ANY, wxString(_("An update is available")) )
{
	wxBoxSizer* szMain = new wxBoxSizer(wxVERTICAL);
	wxGridBagSizer *pGrid = new wxGridBagSizer(10, 10);
	int nFlags=wxALL|wxALIGN_CENTER|wxEXPAND;

	int i=0;

	//Version
	wxStaticText* pL00 = new wxStaticText(this, wxID_ANY, _("To Version:"));
	pGrid->Add(pL00, wxGBPosition(i,0), wxDefaultSpan, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND);
	wxStaticText* pL01 = new wxStaticText(this, wxID_ANY, strVer);
	pGrid->Add(pL01, wxGBPosition(i,1), wxDefaultSpan, nFlags);

	i++;

	//Path
	wxHyperlinkCtrl* pL11 = new wxHyperlinkCtrl(this, wxID_ANY, _("Click here to download update"), strPath);
	pGrid->Add(pL11, wxGBPosition(i,0), wxGBSpan(1,2), wxALIGN_CENTER_HORIZONTAL|wxALL);

	szMain->Add(pGrid, 1, wxALIGN_CENTER|wxALL, 10);
	szMain->Add(200,5);

	wxSizer* sz = CreateStdDialogButtonSizer(wxOK);

	szMain->Add(sz,0, wxALIGN_CENTER|wxALL, 10);

	SetSizer(szMain);

	szMain->Fit(this);

	Centre();

	RequestUserAttention();
}

CUpdateDlg::~CUpdateDlg(void)
{
}
